package MVCEX1BT5;
import java.util.InputMismatchException;
import java.util.Scanner;

public class Views {
public static void main(String[] args) {
	Scanner sc=new Scanner(System.in);
	Object obj=new Object();
	Controllers Implements= new Controllers();
	int i;
	int y=0;
	String x="",z="",w="";
	System.out.println("Chuong trinh se tu dong reset neu nhap sai");
	System.out.println("Vui long nhap day du thong tin: ");
	
	System.out.println("");
	do{	
	i=0;
	System.out.print("Nhap ten: ");
	String temp1=sc.nextLine();
	System.out.print("Nhap tuoi: ");
	String temp2=sc.nextLine();
	sc=new Scanner(System.in);
	
	System.out.print("Nhap gioi tinh: ");
	String temp3=sc.nextLine();
	System.out.print("Nhap tinh trang hon nhan: ");
	String temp4=sc.nextLine();
	try{
		x=temp1;
		y=Integer.parseInt(temp2);
		z=temp3;
		w=temp4;
	}
	catch(NumberFormatException exc){
		i=1;
		System.out.println("------Reset------");
	}
	catch(InputMismatchException exc){
		i=1;
		System.out.println("------Reset------");
	}
	if (i!=1){
	if(!(z.equalsIgnoreCase("nam")||z.equalsIgnoreCase("nu"))){
		i=1;
		System.out.println("------Reset------");
	}}
	if(i!=1){
	if(!(w.equalsIgnoreCase("hon nhan")||z.equalsIgnoreCase("ly hon")||z.equalsIgnoreCase("chua co gia dinh"))){
		i=1;
		System.out.println("------Reset------");
	}
	}}
	while(i==1);
	
	
	obj.setName(x);
	obj.setAge(y);
	obj.setGender(z);
	obj.setStatus(w);
	Implements.RegisControllers(obj);
}
}
